//package com.plian.system.service.tb.impl;
//
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
//import com.plian.Tools.CollectionUtil;
//import com.plian.system.constant.sys.FormTypeConstant;
//import com.plian.system.entity.pf.BusinessIndicators;
//import com.plian.system.entity.tb.TopicRelevance;
//import com.plian.system.entity.tb.TripleMeetingTopic;
//import com.plian.system.mapper.tb.TripleMeetingTopicMapper;
//import com.plian.system.mybatis.base.BaseServiceImpl;
//import com.plian.system.service.sys.code.IFormCodeService;
//import com.plian.system.service.tb.ITopicRelevanceService;
//import com.plian.system.service.tb.ITripleMeetingTopicService;
//import lombok.AllArgsConstructor;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//
//import java.util.List;
//import java.util.Optional;
//import java.util.stream.Collectors;
//
///**
// * @Author: Take-off
// * @Description: TODO 议题信息
// * @Date: 2022/12/29 4:31 PM
// * @Version: 1.0
// **/
//@Service
//@AllArgsConstructor
//public class TripleMeetingTopicServiceImpl extends BaseServiceImpl<TripleMeetingTopicMapper, TripleMeetingTopic> implements ITripleMeetingTopicService {
//
//    private final ITopicRelevanceService topicRelevanceService;
//
//    private IFormCodeService formCodeService;
//
//    @Override
//    public boolean saveOrUpdate(TripleMeetingTopic tripleMeetingTopic) {
//
//        if (!Optional.ofNullable(tripleMeetingTopic.getId()).isPresent()) {
//            //todo code
//            tripleMeetingTopic.setTopicNumber(formCodeService.getCodeName(FormTypeConstant.PF_TRIPLE_MEETING_TOPIC));
//            tripleMeetingTopic.setFormType(String.valueOf(FormTypeConstant.PF_TRIPLE_MEETING_TOPIC));
//        }
//        boolean result = super.saveOrUpdate(tripleMeetingTopic);
//        //关联信息
//        if (result){
//            List<TopicRelevance> topicRelevances = tripleMeetingTopic.getTopicRelevances();
//            if (CollectionUtil.isNotEmpty(topicRelevances)){
//                topicRelevances.forEach(topicRelevance -> {
//                    topicRelevance.setTopicId(tripleMeetingTopic.getId());
//                    topicRelevance.setBaseMeetingId(tripleMeetingTopic.getBaseMeetingId());
//                    topicRelevanceService.saveOrUpdate(topicRelevance);
//                });
//            }
//        }
//        return result;
//    }
//
//
//    @Override
//    @Transactional(rollbackFor=RuntimeException.class)
//    public boolean deleteLogic(List<Long> ids) {
//        for (Long id : ids) {
//            TripleMeetingTopic tripleMeetingTopic = getById(id);
//            if (tripleMeetingTopic == null) {
//                return false;
//            }
//        }
//        boolean result = super.deleteLogic(ids);
//        if (result){
//            topicRelevanceService.deleteByTopicId(ids);
//        }
//        return result;
//    }
//
//    @Override
//    public boolean deleteByParentId(List<Long> ids) {
//        LambdaQueryWrapper<TripleMeetingTopic> queryWrapper = new LambdaQueryWrapper<>();
//        queryWrapper.in(TripleMeetingTopic::getBaseMeetingId, ids);
//        List<TripleMeetingTopic> tripleMeetingTopics = list(queryWrapper);
//        if (CollectionUtil.isNotEmpty(tripleMeetingTopics)){
//            return deleteLogic(tripleMeetingTopics.stream().map(TripleMeetingTopic::getId).collect(Collectors.toList()));
//        }
//        return true;
//    }
//}
